import axios from 'axios'
import cfg from '../cfg/cfg'

// axios.defaults.withCredentials=true;
axios.defaults.headers['Content-Type'] = "application/x-www-form-urlencoded";
// axios.defaults.headers['Access-Control-Allow-Credentials'] = "true";
// axios.defaults.headers['Access-Control-Allow-Origin'] = "*";
// axios.defaults.headers['Access-Control-Allow-Headers'] = "X-Requested-With";
// axios.defaults.headers['Access-Control-Allow-Methods'] = "PUT,POST,GET,DELETE,OPTIONS";

export async function file_uploadfile(file) {
  let param = new FormData();
  param.append("file", file);
  return axios({
    method: "post",
    url: cfg.ApiUrl + "/v1/file/uploadfile",
    param: param,
    headers: {"Content-Type": "multipart/form-data"}
  })
}

export default {
  file_uploadfile
}
